

import java.net.DatagramPacket;
import java.net.InetAddress;

public class SendingService {

    private static SendingService sendingService;


    public synchronized static SendingService getSendingService() {
        if (SendingService.sendingService == null) {
            SendingService.sendingService = new SendingService();
        }
        return sendingService;
    }

    private  SendingService() {
        
    }



    public synchronized void send(String message, InetAddress ip, int toPort)
            throws Exception {
        byte[] sendData = new byte[Properties.MAX_MSG_SIZE];
        sendData = message.getBytes();
        DatagramPacket sendPacket = new DatagramPacket(sendData,
                sendData.length, ip, toPort);
        SelfInfo.sendSocket.send(sendPacket);

    }
}
